feat(engine): expose state_trie_overlays() accessor on TreeState#12
Merged
Merged
Conversation
038dd26 to
0bcc9da
Compare
OpFirehoseEngineValidator (reth-optimism-firehose) is an external re-implementation of BasicEngineValidator that lives outside this crate and therefore cannot read pub(crate) fields. This one-line accessor exposes the existing state_trie_overlays field so external validators can call .with_state_trie_overlay_manager(...) on OverlayBuilder without rebuilding the manager from scratch on every request.
0bcc9da to
f1b8443
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
StateTrieOverlayManager<N>from upstreamparadigmxyz/rethto the StreamingFast fork, introducingstate_trie_overlay.rsinreth-chain-statewith full insert/remove lifecycle management.TreeState: maintained ininsert_executed,reset, andremove_untilto stay in sync with the live in-memory block set.pub fn state_trie_overlays(&self) -> &StateTrieOverlayManager<N>accessor so external crates (reth-optimism-firehose) can read the overlay without re-building it fromblocks_by_hash()on every request.Why
OpFirehoseEngineValidator(in theethereum-optimism/optimismmonorepo) is an external re-implementation ofBasicEngineValidatorwith Firehose live-tracing hooks. It needs to call.with_state_trie_overlay_manager(state.tree_state().state_trie_overlays().clone())to buildOverlayBuilderobjects for in-memory-only blocks — exactly whatBasicEngineValidatordoes internally. Without this accessor the field ispub(crate)and unreachable from outside the crate, forcing workarounds that diverge from upstream behaviour on every future upgrade.Test plan
cargo check -p reth-chain-state— cleancargo check -p reth-engine-tree— cleancargo test -p reth-chain-state— 55 pass, 1 pre-existing failure (lazy_overlay::tests::misordered_blocks_panic)cargo test -p reth-engine-tree— 14 unit + 1 integration pass, 0 failures